package com.liuym.student.repository.mapper;

import com.liuym.common.exception.StudentException;
import com.liuym.student.repository.model.bo.StudentScoreBatchBO;
import com.liuym.student.repository.model.entity.Student;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface StudentMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Student record);

    int insertSelective(Student record);

    Student selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Student record);

    int updateByPrimaryKey(Student record);

    /**
     * 通过学号获得学生信息
     *
     * @param studentNumber
     * @return
     */
    Student getStudentByNumber(Long studentNumber);

    /**
     * 获得全部学生
     *
     * @return
     */
    List<Student> getAllStudent();

    List<Student> getStudentByClass(Long classNumber);

    int deleteStudentBySutdentNumber(Long studentNumber);

    int updateByStudentNumberSelective(Student record);

    /**
     * 根据学号更新分数
     *
     * @param map
     * @return
     */
    int updateScoreByStudentNumber(Map<String, Object> map);

    /**
     * 批量添加学生
     *
     * @param list
     * @return
     */
    int addStudentList(List<Student> list);

    /**
     * 查询所有学生学号
     *
     * @return
     */
    List<Long> findStudentNumberList();

    /**
     * 批量更新score
     *
     * @param list
     * @return
     */
    int updateScoreByStudentNumberBatch(List<StudentScoreBatchBO> list);

    int updateStudentScoreTo80();

    /**
     * 根据学号删除学生
     *
     * @param classNumber
     * @return
     * @throws StudentException
     */
    int deleteStudentByClassNumber(long classNumber) throws StudentException;

    /**
     * 根据班号统计学生数量
     *
     * @param classNumber
     * @return
     */
    Integer getCountByClassNumber(long classNumber);

    void resetPassword(@Param("studentNumber") Long studentNumber, @Param("password") String password);
}